public class Dev541_mod4_sharing {

    public static void SharingDemo()
    {
        //テスト用データの追加
        Account acc = new Account(name='共有追加デモ');
        Insert acc;

        //組織全体グループのID取得
        ID orgID = [SELECT id FROM Group WHERE type='Organization'][0].id;

        //手動共有の設定
         AccountShare aShare = new AccountShare();

        //UserGroupのID
        aShare.UserOrGroupId = orgID;

        //アクセス権の設定
        aShare.AccountAccessLevel = 'Edit';

        //アクセスレベル
        aShare.OpportunityAccessLevel = 'Read';

        //レコードの紐付け
        aShare.AccountId = acc.id;

        //設定の反映
        Insert aShare;
    }
}